String.prototype.trim = function(){
	var str='';
	this.replace(/^\s+/, "");
	for (var i = this.length - 1; i >= 0; i--) {
		if (/\S/.test(this.charAt(i))) {
			str = this.substring(0, i + 1);
			break;
		}
	}
	return str;
}

// Returns true if the passed value is found in the
// array. Returns false if it is not.
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		// Matches identical (===), not just similar (==).
		if (this[i] === value) {
			return true;
		}
	}
	return false;
}

// Remove duplicates elements
Array.prototype.unique= function() {
	var a = [], i, l = this.length;
	for(i = 0; i < l; i++) {
		if(a.indexOf(this[i]) < 0) { 
			a.push(this[i]); 
		}
	}
	return a;
}